package com.dubito.noteapp.data.database.repository

import com.dubito.noteapp.data.database.NoteDao
import com.dubito.noteapp.domain.model.Note
import kotlinx.coroutines.flow.Flow

/**
 * author: LiLiang
 * createTime: 2022/10/7-11:42
 * remark:
 **/
class NoteRepositoryImpl(private val dao: NoteDao) : NoteRepository {

    override fun getNotes(): Flow<List<Note>> {
        return dao.getNotes()
    }

    override suspend fun getNoteById(id: Int): Note? {
        return dao.getNoteById(id)
    }

    override suspend fun insertNote(note: Note) {
        dao.insertNote(note)
    }

    override suspend fun deleteNote(note: Note) {
        dao.deleteNote(note)
    }
}